package com.jiaai.web.xiaoke.version;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiaai.exception.ServerException;
import com.jiaai.util.RestResultGenerator;
import com.jiaai.version.api.TVersionApi;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 佳爱网络科技
 * @since 2018-03-07
 */
@RestController
@RequestMapping("/api/v1/app/version")
public class AppVersionController {
    @Reference
    TVersionApi tVersionApi;

    /**
     * app查询最新一条版本信息
     * @param
     * @return
     * @throws Exception
     */
        @GetMapping("/firstVersion")
    public Object firstVersion() throws ServerException {
        try {
            return RestResultGenerator.genSuccessResult(tVersionApi.firstVersion());
        } catch (Exception e) {
            throw new ServerException("查询失败");
        }
    }
}
